﻿using System;
using System.Data;
using System.Text;
using System.Web.UI.HtmlControls;
using HiauPdm.Bll;
using HiauPdm.Web;

namespace HiauPdm.Web
{
    public partial class PdmLeft : PageBase
    {
        protected override bool IsAccess()
        {
            return true;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string sMenuId = Request.QueryString["MenuId"];
                string sMenuName = Request.QueryString["MenuName"];
                if ((sMenuId != null) && (sMenuId != string.Empty))
                {
                    divTitle.InnerText = sMenuName;
                    DataSet dsMenu = BMain.GetChildMenu(int.Parse(sMenuId), (int)Session["UserId"]);
                    if ((dsMenu != null) && (dsMenu.Tables[0].Rows.Count > 0))
                    {
                        StringBuilder sMenu = new StringBuilder();
                        foreach (DataRow dr in dsMenu.Tables[0].Rows)
                        {
                            sMenu.AppendFormat("\r\n<a href=\"javascript:void(0);\" onfocus=\"blur();\" onclick=\"parent.frameMain.location.replace('{0}');event.returnValue=false;\" title='{1}'>{1}</a>", dr["模块调用"], dr["模块名称"]);
                        }
                        divContent.InnerHtml = sMenu.ToString();
                    }
                    else
                    {
                        divContent.InnerHtml = string.Empty;
                    }
                }
            }
        }
    }
}